package com.saifan.wyy_ov.ui.onlishop;

import java.util.ArrayList;

import com.saifan.wyy_ov.R;
import com.saifan.wyy_ov.ui.view.SquareImageView;
import com.saifan.wyy_ov.utils.CropSquareTransformation;
import com.saifan.wyy_ov.utils.ImgUtil;
import com.squareup.picasso.Picasso;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView.ScaleType;

/**
 * @author WangLi
 * @date 2015年3月26日 下午5:35:43
 * @Description 评论里面的图片
 * @version V1.0
 */

public class CommentsPicAdapter extends BaseAdapter {
	public ArrayList<String> list;
	public Activity activity;
	
	public CommentsPicAdapter(ArrayList<String> list, Activity activity) {
		super();
		this.list = list;
		this.activity = activity;
	}

	@Override
	public int getCount() {
		return list.size();

	}

	@Override
	public Object getItem(int position) {
		return list.get(position);

	}

	@Override
	public long getItemId(int position) {
		return position;

	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder = null;
		if (convertView == null) {
			SquareImageView imgview = new SquareImageView(activity);
			convertView = imgview;
			viewHolder = new ViewHolder();
			viewHolder.imgview = imgview;
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		ImgUtil.DisPlayImgForLocal( list.get(position), viewHolder.imgview,   activity);
		return convertView;
	}
	
	class ViewHolder{
		SquareImageView imgview;
	}
	
}
